<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags" %>
 <!DOCTYPE html>
<html lang="zh-cn">
<head>
 <base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
  <script src="js/selectdata.js"></script>
</head>
<body>

  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
    <form method="post" action="<%=path %>/admin/student_findStudentList.action??pageFinder.pageNo=1" id="searchform">
      <ul class="search" style="padding-left:10px;">
        <li>搜索：</li>
        <li>
        学院
            <select  id="academySelect"  class="input" onchange="changeselect()" style="width:200px; line-height:17px; display:inline-block">
           <option value="">选择学院</option>
          </select>
          <input type="hidden" id="academyName" name="pageing.academy" />
            &nbsp;&nbsp;
          班级
            <select id="classSelect"  class="input" onchange="changeselect1()" style="width:200px; line-height:17px; display:inline-block">
            <option value="">选择班级</option>
          </select>
          <input type="hidden" id="className" name="pageing.stuClass" />
           
        </li>
        <if condition="$iscid eq 1">
          <li>
            <select name="cid" id="cid" class="input" style="width:200px; line-height:17px;" onchange="changeselect3()">
              <option value="">选择分类</option>
              <option value="pageing.stuNo">学号</option>
              <option value="pageing.name">姓名</option>
            </select>
          </li>
        </if>
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="keywords" id="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
      </ul>
      </form>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">编号</th>
        <th width="10%">学号</th>
        <th>姓名</th>
        <th width="50">性别</th>
        <th>班级</th>
        <th>学院</th>
        <th width="10%">录入时间</th>
        <th width="310">操作</th>
      </tr>
      <volist name="list" id="vo">
      <form method="post" action="<%=path %>/admin/student_deleteStudent.action" id="listform">
      <s:iterator value="#request.pageFinder.dataList" id="stu">
        <tr>
          <td style="text-align:left; padding-left:20px;">
          <input type="checkbox" name="deleteList" value="${stu.id }" />
           <s:property value="#stu.id"/></td>
           <td><font color="#00CC99"><s:property value="#stu.stuNo"/> </font></td>
          <td width="10%"><s:property value="#stu.stuName"/></td>
          <td></td>
          <td><s:property value="#stu.stuClass"/></td>
          <td><s:property value="#stu.academy"/></td>
          <td><s:property value="#stu.time"/></td>
          <td><div class="button-group"> <a class="button border-main" href="<%=path %>/admin/student_findStudentById.action?stuId=${stu.id}"><span class="icon-edit"></span> 修改</a> 
          <a class="button border-red" href="javascript:void(0)" onclick="return del(${stu.id},1,1)"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
   		</s:iterator>
   		</form>
      <tr>
      
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="7" style="text-align:left;padding-left:20px;">
        <a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a></td>
      </tr>
      <tr>
        <td colspan="8"><div class="pagelist">
        <a href="<%=path %>/admin/student_findStudentList.action?pageFinder.pageNo=1">首页</a>
         <a href="<%=path %>/admin/student_findStudentList.action?pageFinder.pageNo=
         <s:if test="pageFinder.pageNo==1">${pageFinder.pageNo}</s:if>
         <s:else>${pageFinder.pageNo-1 }</s:else>">上一页</a>
          <span class="current">${pageFinder.pageNo}/${pageFinder.pageCount }</span>
          <a href="<%=path %>/admin/student_findStudentList.action?pageFinder.pageNo=
          <s:if test="pageFinder.pageNo==pageFinder.pageCount">${pageFinder.pageCount}</s:if>
          <s:else>${pageFinder.pageNo+1 }</s:else>">下一页</a>
        <a href="<%=path %>/admin/student_findStudentList.action?pageFinder.pageNo=${pageFinder.pageCount}">尾页</a>
           </div></td>
      </tr>
    </table>
  </div>

<script type="text/javascript">

//搜索

function changesearch(){
	$("#searchform").submit();
}
function changeselect3(){
		$("#keywords").attr('name',$("#cid").val());
}


//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要删除吗?")){
		window.location='<%=path %>/admin/student_deleteStudent.action?student.id='+id;
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='deleteList']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	
	var Checkbox=false;
	 $("input[name='deleteList']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}


</script>
</body>
</html>